package com.xzy.service.impl;

import com.xzy.dao.IUserDao;
import com.xzy.dao.impl.UserDaoImpl;
import com.xzy.domain.User;
import com.xzy.service.IUserService;

public class UserServiceImpl implements IUserService {

private IUserDao dao = new UserDaoImpl();

    @Override
    public void registUser(User user) {
        dao.saveUser(user);

    }

    @Override
    public User login(User user) {
       return dao.queryByUserinfo(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean userNameIsAble(String userName) {
        if(dao.queryUserByUsername(userName)==null){
            return true;
        }
        return false;
    }

    @Override
    public User queryByuserName(String userName) {
        User user = dao.queryUserByUsername(userName);
        return user;
    }
}
